package com.dmai.aiet.epc.archive.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dmai.aiet.epc.archive.base.PageResult;
import com.dmai.aiet.epc.archive.entity.CourseStudyActivities;
import com.dmai.aiet.epc.archive.entity.CourseStudyRecords;
import com.dmai.aiet.epc.archive.mapper.CourseStudyActivitiesDao;
import com.dmai.aiet.epc.archive.service.CourseStudyActivitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;



@Service
public class CourseStudyActivitiesServiceImpl  implements CourseStudyActivitiesService {

    @Autowired
    private CourseStudyActivitiesDao courseStudyActivitiesDao;



    /**
     * 查询记录
     * @param id
     * @return
     */
    public CourseStudyActivities findById(String id){
        return courseStudyActivitiesDao.findById(id);
    }

    /**
     * 分页
     * @param params
     * @return
     */
    public PageResult<CourseStudyActivities> pageAll(Map<String, Object> params){
        Page<CourseStudyActivities> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
        List<CourseStudyActivities> list = courseStudyActivitiesDao.pageAll(page, params);
        long total = page.getTotal();
        if (total > 0) {

        }
        return PageResult.<CourseStudyActivities>builder().data(list).code(0).count(total).build();
    }

    /**
    * 列表
    * @param params
    * @return
    */
    public List<CourseStudyActivities> findAll(Map<String, Object> params){
        return  courseStudyActivitiesDao.findAll(params);
    }

}
